<?php
namespace app\appin\service;

class Router extends BaseService
{
	public static function getFacadeName()
	{
		return 'Router';
	}
	
	/**
	 * 自动加载路由文件
	 */
	public function autoload()
	{
		$appins = Package::allAppin();
		if ( ( $count = count($appins) ) > 0) {
			for ( $i = 0; $i < $count; $i++ ) {
				$routeFile = app()->getRootPath() . '/../appin/'.$appins[$i].'/route.php';
				if ( file_exists($routeFile) ) {
					include_once $routeFile;
				}
			}
		}
	}
}